package com.hcbd.tdwt.ui.haige.setting.activity;

import android.annotation.SuppressLint;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.core.content.ContextCompat;


import com.hcbd.tdwt.R;
import com.hcbd.tdwt.base.BaseActivity;
import com.hcbd.tdwt.base.BeidouBoxParams;
import com.hcbd.tdwt.util.DateUtils;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

@SuppressLint("NonConstantResourceId")
@EActivity(R.layout.activity_sunrise_and_sunset_haige)
public class SunriseAndSunsetActivity extends BaseActivity {

    @ViewById
    TextView title;  // 主标题
    @ViewById
    TextView sunriseTimeTV;  // 日出时间
    @ViewById
    TextView sunsetTimeTV;  // 日落时间
    @ViewById
    RelativeLayout sunriseBgRL;
    @ViewById
    RelativeLayout topRL;
    @AfterViews
    protected void init() {
        title.setText("日出日落");
        String sunset=BeidouBoxParams.sunSet;
        String sunRise=BeidouBoxParams.sunRise;
        if("".equals(sunset)){
            sunset="18:00";
            sunRise="06:00";
        }
        sunriseTimeTV.setText(sunRise);
        sunsetTimeTV.setText(sunset);
        if(DateUtils.timeCompare(sunset+":00")){
            sunriseBgRL.setBackground(ContextCompat.getDrawable(this,R.drawable.sun_bg_haige));
        }else{
            sunriseBgRL.setBackground(ContextCompat.getDrawable(this,R.drawable.sunrise_bg_haige));
        }
        topRL.setBackground(ContextCompat.getDrawable(this,R.drawable.top_bg_haige));
    }


    @Click
    void headLeft(){
        finish();
    }
}